package com.beiding.hotcode;

import java.util.HashMap;
import java.util.Map;

public class MapClassLoader extends ClassLoader {

    public static final MapClassLoader EMPTY = new MapClassLoader();

    private Map<String, Class> loadedClassesMap = new HashMap<>();

    void put(Class clazz) {
        loadedClassesMap.put(clazz.getName(), clazz);
    }

    @Override
    public Class<?> loadClass(String name) throws ClassNotFoundException {
        return loadedClassesMap.get(name);
    }

}
